//
//  YuangongListController.m
//  Ten
//
//  Created by anfuer on 2018/11/17.
//  Copyright © 2018年 xg韦. All rights reserved.
//

#import "YuangongListController.h"
#import "MsgCell.h"
#import "YuangongDetailController.h"
@interface YuangongListController ()
@property (weak, nonatomic) IBOutlet UITableView *tbv;

@end

@implementation YuangongListController

- (void)viewDidLoad {
    [super viewDidLoad];
    _tbv.separatorColor=[UIColor clearColor];
    // Do any additional setup after loading the view.
}
- (IBAction)back:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark 返回每组行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    
    static NSString *ID = @"MsgCell";
    MsgCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
    
}
//设置滑动时显示多个按钮
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
    //添加一个删除按钮
    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:(UITableViewRowActionStyleDestructive) title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
        
    }];
    //删除按钮颜色
    deleteAction.backgroundColor = [UIColor redColor];

    return @[deleteAction];
    
}

#pragma mark 设置每行高度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 64;
}
#pragma mark 点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{
    UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Bmy" bundle:nil];
    YuangongDetailController*secondViewController = [mainStoryBoard instantiateViewControllerWithIdentifier:@"YuangongDetail"];
    [self.navigationController pushViewController:secondViewController animated:YES];
    

}



@end
